package com.corner.ui.base;

import android.widget.BaseAdapter;

import com.corner.app.App;
import com.corner.presenter.base.BasePresenter;
import com.corner.ui.view.base.BaseView;
import com.corner.utils.ToastUtil;

/**
 * Created by Administrator on 2015/7/14，22.21.
 * 描述：
 */
public abstract class BaseMVPAdapter<P extends BasePresenter> extends BaseAdapter implements BaseView {

    protected P presenter;

    public BaseMVPAdapter() {
        this.presenter = createP();
        presenter.setView(this);
    }

    protected abstract P createP();

    @Override
    public void showLoading(boolean isShow) {
    }

    public void onDestroy() {
        if (presenter != null) {
            presenter.onDestroy();
        }
        presenter = null;
    }

    @Override
    public void showError(String message) {
        ToastUtil.showCustomToastInDevelop(App.application, message);
    }
}
